#pragma once
using namespace std;
#include "PipeView.h"
#include "Pipe.h"
#include <vector>
class OceanPipeView:public PipeView
{
public:
	OceanPipeView(void);
	~OceanPipeView(void);

	virtual void drawPipe(CPipe* pipe, CPaintDC* dc)
    { 
		CGdiObject *oldBrush = dc->SelectStockObject(DC_BRUSH);
		CGdiObject *oldPen = dc->SelectStockObject(DC_PEN);
		if(pipe->getState()==CPipe::NORMAL_STATE)
			dc->SetDCPenColor(RGB(0,255,0));
		else if(pipe->getState()==CPipe::CRITICAL_STATE)
			dc->SetDCPenColor(RGB(255,0,0));
		else if(pipe->getState()==CPipe::WARNING_STATE)
			dc->SetDCPenColor(RGB(255,255,0));

		vector<CPoint>* points = pipe->getPoints();
		for(int i=0; i<points->size()-1; i++)
		{
			dc->MoveTo(points->at(i).x,points->at(i).y);
			dc->LineTo(points->at(i+1).x,points->at(i+1).y);
		}
		
		dc->SelectObject(oldBrush);
		dc->SelectObject(oldPen);
    }
};

